package com.ruoyi.project.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.project.system.domain.SysDistribution;
import com.ruoyi.project.system.mapper.SysDistributionMapper;
import com.ruoyi.project.system.service.ISysDistributionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 出库任务Service业务层处理
 *
 * @author orange
 * @date 2022-04-09
 */
@Service
public class SysDistributionServiceImpl implements ISysDistributionService {
  @Autowired private SysDistributionMapper sysDistributionMapper;

  /**
   * 查询出库任务
   *
   * @param distributionId 出库任务主键
   * @return 出库任务
   */
  @Override
  public SysDistribution selectSysDistributionByDistributionId(Long distributionId) {
    return sysDistributionMapper.selectSysDistributionByDistributionId(distributionId);
  }

  /**
   * 查询出库任务列表
   *
   * @param sysDistribution 出库任务
   * @return 出库任务
   */
  @Override
  public List<SysDistribution> selectSysDistributionList(SysDistribution sysDistribution) {
    return sysDistributionMapper.selectSysDistributionList(sysDistribution);
  }

  /**
   * 新增出库任务
   *
   * @param sysDistribution 出库任务
   * @return 结果
   */
  @Override
  public int insertSysDistribution(SysDistribution sysDistribution) {
    sysDistribution.setCreateTime(DateUtils.getNowDate());
    return sysDistributionMapper.insertSysDistribution(sysDistribution);
  }

  /**
   * 修改出库任务
   *
   * @param sysDistribution 出库任务
   * @return 结果
   */
  @Override
  public int updateSysDistribution(SysDistribution sysDistribution) {
    sysDistribution.setUpdateTime(DateUtils.getNowDate());
    return sysDistributionMapper.updateSysDistribution(sysDistribution);
  }

  /**
   * 批量删除出库任务
   *
   * @param distributionIds 需要删除的出库任务主键
   * @return 结果
   */
  @Override
  public int deleteSysDistributionByDistributionIds(Long[] distributionIds) {
    return sysDistributionMapper.deleteSysDistributionByDistributionIds(distributionIds);
  }

  /**
   * 删除出库任务信息
   *
   * @param distributionId 出库任务主键
   * @return 结果
   */
  @Override
  public int deleteSysDistributionByDistributionId(Long distributionId) {
    return sysDistributionMapper.deleteSysDistributionByDistributionId(distributionId);
  }
}
